'use strict';

module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const ProductSchema = new Schema({
    title: { type: String },
    content: { type: String },
    amount: { type: Number },
    type: { type: String },
    has_chat_room: { type: Boolean },
    state: { type: String },
    create_at: { type: Date, default: Date.now },
    update_at: { type: Date, default: Date.now },
  });

  return mongoose.model('Product', ProductSchema);
};